#include "StdAfx.h"
#include "LPProductWareHouse.h"

CLPProductWareHouse::CLPProductWareHouse(void)
{
}

CLPProductWareHouse::~CLPProductWareHouse(void)
{
}

bool CLPProductWareHouse::SetCapacity(int iBlastPileCount)
{
	if (iBlastPileCount <= 0)
		return false;

	std::vector<CLPModelDecVarFactor> vDecVar;
	for (int i=0; i<iBlastPileCount; ++i)
	{
		m_vDecVarArr.push_back(vDecVar);
	}

	return true;
}

bool CLPProductWareHouse::AddProduct(std::vector<std::vector<CLPModelDecVarFactor>>& vDecVarArr)
{
	if (vDecVarArr.empty() || m_vDecVarArr.empty())
		return false;

	if (m_vDecVarArr.size() != vDecVarArr.size())
		return false;

	for (int i=0; i<(int)vDecVarArr.size(); ++i)
	{
		std::vector<CLPModelDecVarFactor> vDecVar = m_vDecVarArr.at(i);

		for (int j=0; j<(int)vDecVarArr.at(i).size(); ++j)
		{
			vDecVar.push_back(vDecVarArr.at(i).at(j));
		}	
		m_vDecVarArr.at(i) = vDecVar;
	}

	return true;
}
